<?php
add_action('save_post', 'save_post_data');
function save_post_data($post_id) {
// verify this came from our screen and with proper authorization.
 	if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 
		return $post_id;	
	// Check permissions
	if ( 'page' == $_POST['post_type'] ) {
		if ( !current_user_can( 'edit_page', $post_id ) )
			return $post_id;
	} else {
		if ( !current_user_can( 'edit_post', $post_id ) )
		return $post_id;
	}	
 
  	// OK, we're authenticated: we need to find and save the data
	$post = get_post($post_id);
	if ($post->post_type == 'library') { 
           // OR $post->post_type != 'revision'
		   $my_post = array();
           $my_post['authors'] = $_POST['authors'];
		   $my_post['publishers'] = $_POST['publishers'];
		   $my_post['editions'] = $_POST['editions'];
		   $my_post['classcat']= $_POST['classcat'];
		   $my_post['dates']= $_POST['dates'];
	   wp_set_object_terms( $post_id, $my_post['authors'], 'authors', true );
	   wp_set_object_terms( $post_id, $my_post['publishers'], 'publishers' ,true);
	   wp_set_object_terms( $post_id, $my_post['editions'], 'editions' ,true);
	   wp_set_object_terms( $post_id, $my_post['classcat'], 'classcat' ,true);
	   wp_set_object_terms( $post_id, $my_post['dates'], 'dates' ,true);

        }
	return $my_post;
  update_post_meta($post->ID, "bookid", $_POST["bookid"]);
  update_post_meta($post->ID, "receive_date", $_POST["receive_date"]);
  update_post_meta($post->ID, "from", $_POST["from"]);
  update_post_meta($post->ID, "price", $_POST["price"]);
  update_post_meta($post->ID, "copies", $_POST["copies"]);
  update_post_meta($post->ID, "pub_year", $_POST["pub_year"]);
  update_post_meta($post->ID, "authors", $_POST["authors"]);
  update_post_meta($post->ID, "editions", $_POST["editions"]);
  update_post_meta($post->ID, "publishers", $_POST["pblishers"]);
  update_post_meta($post->ID, "classcat", $_POST["classcat"]);
  update_post_meta($post->ID, "dates", $_POST["dates"]);
}
?>